#ifndef _Parser_H
#define _Parser_H

#include "Token.h"
#include "TokenNode.h"
#include "Tokenizer.h"

class Parser 
{
public:
	typedef Tokenizer::const_iterator const_iterator;	
	Parser(const_iterator begin, const_iterator end);

	TokenNode const* getRoot();	
	~Parser();	
private:
	TokenNode* root;    
   
	TokenNode* parserExpr(const_iterator begin, const_iterator end);
   
	TokenNode* addExpr(const_iterator begin, const_iterator end, size_t & pos);    
    TokenNode* multExpr(const_iterator begin, const_iterator end, size_t & pos);    
	TokenNode* atomExpr(const_iterator begin, size_t & pos);

	void deleteNode(TokenNode const* p);
};

void printNode (TokenNode const* p);

#endif
